<include file='Index/header' />
<div class="row">
	<br>
	<div class="col-sm-12">
		<br>
	<table id="admin_list_table" class="table table-hover table-bordered table-striped table-striped">
		<thead>
			<tr>
				<td>编号</td>
				<td>仓库</td>
				<td>商品</td>
				<td>剩余量</td>
				<td>默认库存警告量</td>
			</tr>
		</thead>
		<tbody>

		</tbody>
	</table>
</div>
</div>

<include file='Index/footer' />
<link href="__PUBLIC__/bower_components/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script src="__PUBLIC__/bower_components/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="__PUBLIC__/bower_components/datetimepicker/bootstrap-datetimepicker.zh-CN.js"></script>

<script>
$(document).ready(function() {
	loadTable();
});

var table;
function loadTable(){
	table = $('#admin_list_table').DataTable({
		"bProcessing": true,
		"bDestroy": true,
		"sPaginationType" : "input",
		"oLanguage" : {
              "sLengthMenu": "每页显示 _MENU_ 条记录",
              "sZeroRecords": "抱歉， 没有找到",
              "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
              "sInfoEmpty": "没有数据",
              "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
              "sZeroRecords": "没有检索到数据",
               "sSearch": "搜索: &nbsp",
              "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "前一页",
                "sNext": "后一页",
                "sLast": "尾页"
              }
          }, 
		"ajax":'{:U("Admin/Repository/getRepositoryWarn/")}',
		"columns": [
					{ "data": 'id' },
					{ "data": 'repository' },
	        { "data": 'name' },
	        { "data": 'default_amount' },
	        { "data": 'warning_amount' }
    ],
    "columnDefs": [
    {
			"targets": 0,
			"render": function (data, type, row, table) {
        return table.row + 1;
      }
    },
    {
			"targets": 1,
			"render": function (data, type, row, table) {
        return (row.a_repository==null?'':row.a_repository.name) + (row.b_repository==null?'':row.b_repository.name);
      }
    }
   ]
	});

}

</script>
